import Vue from "vue";
//配置路由
import VueRouter from "vue-router";
Vue.use(VueRouter);

//2.配置路由   注意：名字
const routes = [
  {
    path: "/index",
    name: "首页",
    component: () => import("@/views/index"),
    children: [
      {
        // 这里不设置值，是把main作为默认页面
        path: "/",
        name: "首页",
        component: () => import("@/views/home"),
        meta: { icon: "", title: "center" },
      },
      {
        path: "/updatePassword",
        name: "修改密码",
        component: () => import("@/views/update-password"),
        meta: { icon: "", title: "updatePassword" },
      },
      {
        path: "/pay",
        name: "支付",
        component: () => import("@/views/pay"),
        meta: { icon: "", title: "pay" },
      },
      {
        path: "/center",
        name: "个人信息",
        component: () => import("@/views/center"),
        meta: { icon: "", title: "center" },
      },
      {
        path: "/users",
        name: "管理信息",
        component: () => import("@/views/modules/users/list"),
      },
      {
        path: "/dictionaryCheliang",
        name: "车辆类型",
        component: () => import("@/views/modules/dictionaryCheliang/list"),
      },
      {
        path: "/dictionaryCheliangStatus",
        name: "车辆状态",
        component: () => import("@/views/modules/dictionaryCheliangStatus/list"),
      },
      {
        path: "/dictionaryNews",
        name: "公告类型",
        component: () => import("@/views/modules/dictionaryNews/list"),
      },
      {
        path: "/dictionarySex",
        name: "性别",
        component: () => import("@/views/modules/dictionarySex/list"),
      },
      {
        path: "/dictionaryWuliu",
        name: "物流状态",
        component: () => import("@/views/modules/dictionaryWuliu/list"),
      },
      {
        path: "/dictionaryYundanStatus",
        name: "运单状态",
        component: () => import("@/views/modules/dictionaryYundanStatus/list"),
      },
      {
        path: "/cheliang",
        name: "车辆信息",
        component: () => import("@/views/modules/cheliang/list"),
      },
      {
        path: "/dictionary",
        name: "字典表",
        component: () => import("@/views/modules/dictionary/list"),
      },
      {
        path: "/news",
        name: "公告信息",
        component: () => import("@/views/modules/news/list"),
      },
      {
        path: "/siji",
        name: "司机",
        component: () => import("@/views/modules/siji/list"),
      },
      {
        path: "/wuliu",
        name: "物流信息",
        component: () => import("@/views/modules/wuliu/list"),
      },
      {
        path: "/yonghu",
        name: "用户",
        component: () => import("@/views/modules/yonghu/list"),
      },
      {
        path: "/yundan",
        name: "运单信息",
        component: () => import("@/views/modules/yundan/list"),
      },
    ],
  },
  {
    path: "/login",
    name: "login",
    component: () => import("@/views/login"),
    meta: { icon: "", title: "login" },
  },
  {
    path: "/register",
    name: "register",
    component: () => import("@/views/register"),
    meta: { icon: "", title: "register" },
  },
  {
    path: "/",
    name: "首页",
    redirect: "/index",
  } /*默认跳转路由*/,
  {
    path: "*",
    component: () => import("@/views/404"),
  },
];
//3.实例化VueRouter  注意：名字
const router = new VueRouter({
  mode: "hash",
  /*hash模式改为history*/
  routes, // （缩写）相当于 routes: routes
});

export default router;
